import Home from "@/page/Home";
import Login from "@/page/Login";
import Search from "@/page/Search";
import Register from "@/page/Register";
import Detail from "@/page/Detail";
import AddCartSuccess from "@/page/AddCartSuccess";
import ShopCart from "@/page/ShopCart";
import Trade from "@/page/Trade";
const routes = [
    {
        path: "/home",
        component: Home
    },
    {
        path: "/login",
        component: Login
    },
    {
        path: '/search/:keyword?',
        component: Search,
        name: 'search',
        props: (route) => {
            return {
                keyword: route.params.keyword
            }
        }
    },
    //购物车结算
    {
        path: '/shopCart',
        component: ShopCart,
        caseSensitive:true,
    },
    //订单信息路由
    {
        path: '/trade',
        component: Trade
    },
    {
        path:'/detail/:skuId.html',
        component: Detail
    },
    //购物车路由
    {
        path: `/AddCartSuccess/:skuNum`,
        caseSensitive:true,
        component: AddCartSuccess
    },
    {
        path: "/register",
        component: Register
    },
    {
        path: "/",
        redirect: '/home'
    }
]
export default routes;